package com.clwl.supervise.superviseapp.controller.inspection;


import cn.hutool.extra.spring.SpringUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.clwl.supervise.superviseapp.entity.result.ResultEntity;
import com.clwl.supervise.superviseapp.service.inspect.IntelligentTaskService;
import com.clwl.supervise.superviseapp.service.inspect.SchemePlanService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 * 智能任务
 */
@Slf4j
@RestController
@RequestMapping("intelligentTask")
public class IntelligentTaskController {


    @Resource
    private IntelligentTaskService intelligentTaskService;

    /**
     * 体系检查列表信息
     * @param pageNum
     * @param pageSize
     * @param sortType 1-按时限；2-按任务多少；3-按发现问题；4-按风险高低
     * @param sortOrder 正序还是倒序 1-正序；2-倒序
     * @return
     */
    @GetMapping("getList")
    private ResultEntity<IPage<Map<String,Object>>> getTaskList(@RequestParam(required = true) Integer pageNum, @RequestParam(required = true) Integer pageSize,
                                                                   Integer sortType,Integer sortOrder){

        log.info("pageNum:{}",pageNum);
        log.info("pageSize:{}",pageSize);
        SchemePlanService schemePlanService = SpringUtil.getBean(SchemePlanService.class);
        log.info("schemePlanService1:{}",schemePlanService);
        IPage<Map<String,Object>> pageList = intelligentTaskService.getTaskList(pageNum,pageSize,sortType,sortOrder);
        return ResultEntity.success(pageList);
    }


}
